Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize GHASH: allowing GCM to accept input that is not block-aligned #4469

Merged
merged 1 commit into from
Dec 22, 2024

Conversation

reneme
Copy link
Collaborator

@reneme reneme commented Dec 6, 2024

Most notably, this lifts the limitation that GHASH::update() requires block-aligned data input by transparently caching non-aligned data using the AlignmentBuffer helper. With that, the GCM mode of operation can stream-process data that is not block aligned.

The GMAC used to contain an AlignmentBuffer to handle the same limitation described above. This was removed, as GHASH now handles non-aligned data transparently.

Finally, this cleans up the state management of GHASH as much as possible and removes a few public interfaces.

@reneme reneme added the enhancement Enhancement or new feature label Dec 6, 2024
@reneme reneme added this to the Botan 3.7.0 milestone Dec 6, 2024
@reneme reneme self-assigned this Dec 6, 2024
@reneme reneme force-pushed the feature/byte_wise_gcm branch 2 times, most recently from d53103c to f10c080 Compare December 6, 2024 20:52
@coveralls
Copy link

coveralls commented Dec 6, 2024

Coverage Status

coverage: 91.249% (-0.005%) from 91.254%
when pulling 1d46787 on Rohde-Schwarz:feature/byte_wise_gcm
into e49ede1 on randombit:master.

Copy link
Owner

@randombit randombit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and a nice cleanup! Thanks

src/lib/utils/ghash/ghash.cpp Outdated Show resolved Hide resolved
Most notably, this lifts the limitation that GHASH::update() requires
block-aligned data input by transparently caching non-aligned data
using the AlignmentBuffer helper. With that, the GCM mode of operation
can stream-process data that is not block aligned.

The GMAC used to contain an AlignmentBuffer to handle the same limitation
described above. This was removed, as GHASH now handles non-aligned data
transparently.

Finally, this cleans up the state management of GHASH as much as possible
and removes a few public interfaces.
@reneme reneme force-pushed the feature/byte_wise_gcm branch from f10c080 to 1d46787 Compare December 22, 2024 18:52
@reneme reneme merged commit c795370 into randombit:master Dec 22, 2024
38 checks passed
@reneme reneme deleted the feature/byte_wise_gcm branch December 22, 2024 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants